package cn.com.homeyoda.aimate.aihealth.ui.health_qa;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wzq.mvvmsmart.utils.GlideLoadUtils;

import java.util.List;

import cn.com.homeyoda.aimate.aihealth.R;
import cn.com.homeyoda.aimate.aihealth.bean.QuizListBean;

public class HealthQaListAdapter extends BaseQuickAdapter<QuizListBean.RowsBean, BaseViewHolder> {

    public HealthQaListAdapter(int layoutResId, @Nullable List<QuizListBean.RowsBean> data, Context context) {
        super(layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, QuizListBean.RowsBean item) {

    }

    @Override
    public void onBindViewHolder(BaseViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        QuizListBean.RowsBean item = getData().get(position);
        String quizName = item.getQuizName();
        holder.setText(R.id.tv_quiz_name, quizName);
        ImageView imageView = holder.getView(R.id.ib_test_item_bg);
        GlideLoadUtils.loadRoundCornerImg(imageView,item.getImage(),R.mipmap.ic_kepu1,20);

        holder.setText(R.id.tv_user_count, item.getUserCount() + "人参与测试");
        holder.addOnClickListener(R.id.btn_start_test);
    }

    @Override
    public void setNewData(@Nullable List<QuizListBean.RowsBean> data) {
        super.setNewData(data);
    }
}
